﻿<phone:PhoneApplicationPage
    x:Class="DnD.BrowsePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False"
    Style="{StaticResource TransitionPageStyle}">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" >
        <Grid.Background>
            <ImageBrush Stretch="UniformToFill"  ImageSource="{Binding  BackGroundImageSource}" />
        </Grid.Background>

        <!--Pivot Control-->
        <phone:Pivot Title="MY APPLICATION">
            <!--Pivot item one-->
            <phone:PivotItem Header="Cards">
                <ScrollViewer>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="220" />

                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" BorderThickness="5" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="70      " />
                                    <RowDefinition Height="70" />
                                    <RowDefinition Height="70" />
                                
                                </Grid.RowDefinitions>
                                <StackPanel Grid.Row="0" Orientation="Horizontal">
                                    <TextBlock Text="Name:" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0"/>
                                    <TextBox Width="280" Height="70" VerticalAlignment="Center" Text="{Binding LocalCardSearchName, Mode=TwoWay}" Margin="0,10" />
                                </StackPanel>
                                <StackPanel Grid.Row="1" Orientation="Horizontal">
                                    <TextBlock Text="Description:" VerticalAlignment="Center" FontSize="20"  Margin="10,0,0,0"/>
                                    <TextBox Width="280" Height="70" VerticalAlignment="Center"  Text="{Binding LocalCardSearchDesc, Mode=TwoWay}" Margin="0,10"/>
                                </StackPanel>
                                <StackPanel Grid.Row="2" Orientation="Horizontal" >
                                    <TextBlock Text="Rating:" VerticalAlignment="Center" FontSize="20"  Margin="10,0,0,0"/>
                                    <toolkit:Rating   RatingItemCount="5" Value="{Binding LocalCardSearchRate, Mode=TwoWay}"  Margin="5,-5,0,0" Width="150" Height="30" Background="Transparent" VerticalAlignment="Center" >
                                        <toolkit:Rating.FilledItemStyle>
                                            <Style TargetType="toolkit:RatingItem">
                                                <Setter Property="Background" Value="White" />
                                            </Style>
                                        </toolkit:Rating.FilledItemStyle>
                                        <toolkit:Rating.UnfilledItemStyle>
                                            <Style TargetType="toolkit:RatingItem">
                                                <Setter Property="Background" Value="{StaticResource BorderColor}" />
                                            </Style>
                                        </toolkit:Rating.UnfilledItemStyle>
                                    </toolkit:Rating>
                                </StackPanel>
                                <Button Command="{Binding SearchLocalCardsCommand}" Content="Search" HorizontalAlignment="Right"   VerticalAlignment="Bottom" Height="80" Grid.Row="3" Background="{StaticResource BorderColor}"></Button>
                            </Grid>
                        </Border>

                        <phone:LongListSelector Grid.Row="1" Margin="0,10,-22,2" ItemsSource="{Binding LocalCards}" SelectionChanged="LocalCardList_SelectionChanged" >
                       
                            <phone:LongListSelector.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="140" Width="432" >
                                        <!--Replace rectangle with image-->
                                        <Border BorderThickness="3" Width="140" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BorderColor}" >
                                            <Image Source="{Binding PictureURL}"  Width="138" Height="138" Stretch="UniformToFill"/>
                                        </Border>
                                        <!--<Border Margin="8,0,0,0"  BorderThickness="3" Width="275" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}" >-->

                                        <StackPanel Width="311" >

                                            <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Margin="10,0" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeLarge}" />
                                            <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="10,-2,10,0" Style="{StaticResource CardDescTextStyle}" />
                                            <toolkit:Rating ReadOnly="True" RatingItemCount="5" Value="{Binding Rate}"  Width="125" Height="25" Background="Transparent"/>

                                        </StackPanel>
                                        <!--</Border>-->
                                    </StackPanel>
                                </DataTemplate>
                            </phone:LongListSelector.ItemTemplate>
                        </phone:LongListSelector>

                    </Grid>
                </ScrollViewer>
            </phone:PivotItem>

            <!--Pivot item two-->
            <phone:PivotItem Header="Decks">
                <Grid/>
            </phone:PivotItem>

            <phone:PivotItem Header="Online Decks">
                <Grid/>
            </phone:PivotItem>

            <phone:PivotItem Header="My Decks">
                <Grid/>
            </phone:PivotItem>

            <phone:PivotItem Header="My Cards">
                <ScrollViewer>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="292" />

                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" BorderThickness="5" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="70      " />
                                    <RowDefinition Height="70" />
                                    <RowDefinition Height="70" />
                                    <RowDefinition Height="72" />

                                </Grid.RowDefinitions>
                                <StackPanel Grid.Row="0" Orientation="Horizontal">
                                    <TextBlock Text="Name:" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0"/>
                                    <TextBox Width="280" Height="70" VerticalAlignment="Center" Text="{Binding MyCardSearchName, Mode=TwoWay}" Margin="0,10" />
                                </StackPanel>
                                <StackPanel Grid.Row="1" Orientation="Horizontal">
                                    <TextBlock Text="Description:" VerticalAlignment="Center" FontSize="20"  Margin="10,0,0,0"/>
                                    <TextBox Width="280" Height="70" VerticalAlignment="Center"  Text="{Binding MyCardSearchDesc, Mode=TwoWay}" Margin="0,10"/>
                                </StackPanel>
                                <StackPanel Grid.Row="2" Orientation="Horizontal" >
                                    <TextBlock Text="Rating:" VerticalAlignment="Center" FontSize="20"  Margin="10,0,0,0"/>
                                    <toolkit:Rating   RatingItemCount="5" Value="{Binding MyCardSearchRate, Mode=TwoWay}"  Margin="5,-5,0,0" Width="150" Height="30" Background="Transparent" VerticalAlignment="Center" >
                                        <toolkit:Rating.FilledItemStyle>
                                            <Style TargetType="toolkit:RatingItem">
                                                <Setter Property="Background" Value="White" />
                                            </Style>
                                        </toolkit:Rating.FilledItemStyle>
                                        <toolkit:Rating.UnfilledItemStyle>
                                            <Style TargetType="toolkit:RatingItem">
                                                <Setter Property="Background" Value="{StaticResource BorderColor}" />
                                            </Style>
                                        </toolkit:Rating.UnfilledItemStyle>
                                    </toolkit:Rating>
                                </StackPanel>
                                <CheckBox Grid.Row="3" IsChecked="{Binding MyCardSearchOnlineAlso, Mode=TwoWay}" Content="Search also online"  FontSize="20"  VerticalAlignment="Center"/>
                                <Button Command="{Binding SearchMyCardsCommand}" Content="Search" HorizontalAlignment="Right"   VerticalAlignment="Bottom" Height="80" Grid.Row="3" Background="{StaticResource BorderColor}"></Button>
                            </Grid>
                        </Border>

                        <phone:LongListSelector Grid.Row="1" Margin="0,10,-22,2" ItemsSource="{Binding MyCards}" SelectionChanged="MyCardList_SelectionChanged" >

                            <phone:LongListSelector.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="140" Width="432" >
                                        <!--Replace rectangle with image-->
                                        <Border BorderThickness="3" Width="140" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BorderColor}" >
                                            <Image Source="{Binding PictureURL}"  Width="138" Height="138" Stretch="UniformToFill"/>
                                        </Border>
                                        <!--<Border Margin="8,0,0,0"  BorderThickness="3" Width="275" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}" >-->

                                        <StackPanel Width="311" >

                                            <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Margin="10,0" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeLarge}" />
                                            <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="10,-2,10,0" Style="{StaticResource CardDescTextStyle}" />
                                            <toolkit:Rating ReadOnly="True" RatingItemCount="5" Value="{Binding Rate}"  Width="125" Height="25" Background="Transparent"/>

                                        </StackPanel>
                                        <!--</Border>-->
                                    </StackPanel>
                                </DataTemplate>
                            </phone:LongListSelector.ItemTemplate>
                        </phone:LongListSelector>

                    </Grid>
                </ScrollViewer>
            </phone:PivotItem>

            <phone:PivotItem Header="Online Cards">
                <ScrollViewer>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="220" />

                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" BorderThickness="5" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="70      " />
                                    <RowDefinition Height="70" />
                                    <RowDefinition Height="70" />

                                </Grid.RowDefinitions>
                                <StackPanel Grid.Row="0" Orientation="Horizontal">
                                    <TextBlock Text="Name:" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0"/>
                                    <TextBox Width="280" Height="70" VerticalAlignment="Center" Text="{Binding OnlineCardSearchName, Mode=TwoWay}" Margin="0,10" />
                                </StackPanel>
                                <StackPanel Grid.Row="1" Orientation="Horizontal">
                                    <TextBlock Text="Description:" VerticalAlignment="Center" FontSize="20"  Margin="10,0,0,0"/>
                                    <TextBox Width="280" Height="70" VerticalAlignment="Center"  Text="{Binding OnlineCardSearchDesc, Mode=TwoWay}" Margin="0,10"/>
                                </StackPanel>
                                <StackPanel Grid.Row="2" Orientation="Horizontal" >
                                    <TextBlock Text="Rating:" VerticalAlignment="Center" FontSize="20"  Margin="10,0,0,0"/>
                                    <toolkit:Rating   RatingItemCount="5" Value="{Binding OnlineCardSearchRate, Mode=TwoWay}"  Margin="5,-5,0,0" Width="150" Height="30" Background="Transparent" VerticalAlignment="Center" >
                                        <toolkit:Rating.FilledItemStyle>
                                            <Style TargetType="toolkit:RatingItem">
                                                <Setter Property="Background" Value="White" />
                                            </Style>
                                        </toolkit:Rating.FilledItemStyle>
                                        <toolkit:Rating.UnfilledItemStyle>
                                            <Style TargetType="toolkit:RatingItem">
                                                <Setter Property="Background" Value="{StaticResource BorderColor}" />
                                            </Style>
                                        </toolkit:Rating.UnfilledItemStyle>
                                    </toolkit:Rating>
                                </StackPanel>
                                <Button Command="{Binding SearchOnlineCardsCommand}" Content="Search" HorizontalAlignment="Right"   VerticalAlignment="Bottom" Height="80" Grid.Row="3" Background="{StaticResource BorderColor}"></Button>
                            </Grid>
                        </Border>

                        <phone:LongListSelector Grid.Row="1" Margin="0,10,-22,2" ItemsSource="{Binding OnlineCards}" SelectionChanged="OnlineCardList_SelectionChanged"  >

                            <phone:LongListSelector.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="140" Width="432" >
                                        <!--Replace rectangle with image-->
                                        <Border BorderThickness="3" Width="140" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BorderColor}" >
                                            <Image Source="{Binding PictureURL}"  Width="138" Height="138" Stretch="UniformToFill"/>
                                        </Border>
                                        <!--<Border Margin="8,0,0,0"  BorderThickness="3" Width="275" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}" >-->

                                        <StackPanel Width="311" >

                                            <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Margin="10,0" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeLarge}" />
                                            <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="10,-2,10,0" Style="{StaticResource CardDescTextStyle}" />
                                            <toolkit:Rating ReadOnly="True" RatingItemCount="5" Value="{Binding Rate}"  Width="125" Height="25" Background="Transparent"/>

                                        </StackPanel>
                                        <!--</Border>-->
                                    </StackPanel>
                                </DataTemplate>
                            </phone:LongListSelector.ItemTemplate>
                        </phone:LongListSelector>

                    </Grid>
                </ScrollViewer>
            </phone:PivotItem>
        </phone:Pivot>
    </Grid>

</phone:PhoneApplicationPage>